package com.beiding.hotcode.v2;

import java.util.HashMap;
import java.util.Map;

public class MapClassLoader extends ClassLoader {

    public static final MapClassLoader EMPTY = new MapClassLoader();

    private Map<String, ClassFileHolder> loadedClassesMap = new HashMap<>();
/*

    void put(ClassFileHolder clazz) {
        for (String s : clazz.classMap.keySet()) {
            loadedClassesMap.put(s, clazz);
        }
    }
*/

    @Override
    public Class<?> loadClass(String name) {
        ClassFileHolder classFileHolder = loadedClassesMap.get(name);
        if (classFileHolder == null) {
            return null;
        }
        return classFileHolder.get(name);
    }

}
